#include <stdio.h>
#include "driver/gpio.h"

#ifndef	_TM1638_H
#define	_TM1638_H
#ifdef __cplusplus
extern "C" {
#endif
//TM1638模块引脚定义
#define DIO 18
#define CLK 19
#define STB 21

//共阴数码管显示代码0~9 A~F
static u_char tab[]={0x3F,0x06,0x5B,0x4F,0x66,0x6D,0x7D,0x07,  \
              0x7F,0x6F,0x77,0x7C,0x39,0x5E,0x79,0x71};

#define SMa 0x01
#define SMb 0x02
#define SMc 0x04
#define SMd 0x08
#define SMe 0x10
#define SMf 0x20
#define SMg 0x40

 static uint8_t init_gpio_flag = 0;
 void init_gpio();
 void TM1638_Write(u_char DATA);			//写数据函数

 u_char TM1638_Read(void);					//读数据函数

 void Write_COM(u_char cmd);		//发送命令字

 u_char Read_key(void);
 void Write_DATA(u_char add,u_char DATA);		//指定地址写入数据
 void Write_allLED(u_char LED_flag);					//控制全部LED函数，LED_flag表示各个LED状态

//TM1638初始化函数
 void init_TM1638(void);

#ifdef __cplusplus
}
#endif
#endif
